package com.xcdh.ittools.reflection;

import com.baomidou.mybatisplus.extension.MybatisMapWrapperFactory;
import org.apache.ibatis.reflection.DefaultReflectorFactory;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.property.PropertyTokenizer;

public class SimpleMetaObject {
    private MetaObject metaObject ;

    public SimpleMetaObject(Object o){
        this.metaObject = MetaObject.forObject(o,  new DefaultObjectFactory(), new MybatisMapWrapperFactory(), new DefaultReflectorFactory());
    }

    public Object getValue(String name){
        return this.metaObject.getValue(name) ;
    }

    public void setValue(String name, Object value) {
        this.metaObject.setValue(name , value) ;
    }

    public String findProperty(String name , boolean useCamelCaseMapping){
       return metaObject.findProperty(name , useCamelCaseMapping) ;
    }

    public Class<?> getSetterType(String property){
        return metaObject.getSetterType(property ) ;
    }



}
